<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template">
    <meta name="author" content="GeeksLabs">
    <meta name="keyword" content="Creative, Dashboard, Admin, Template, Theme, Bootstrap, Responsive, Retina, Minimal">
    <title>Show Log</title>

</head>

<body style="background-color:oldlace">
<p class="text-404">等待任务..</p>
<input value='' id='v' type="text" style="display:none;">
<!--<button type="button" onclick=a() >Click Me!</button>-->
<br/>
<div>
    <textarea readonly id="txt"
              style="width: 100%; height: 635px;background: black none repeat scroll 0% 0%; color: rgb(153, 153, 153);"></textarea>
</div>
</body>
</html>

<script src='//cdn.bootcss.com/socket.io/1.3.7/socket.io.js'></script>
<script>
    ws = new WebSocket("ws://xxx.xxx.xxx:8936"); //ip地址或者访问域名
    ws.onopen = function () {
        ws.send('tom');
    };
    ws.onmessage = function (e) {
        oTest = document.getElementById("txt");

        oTest.innerHTML = oTest.innerHTML + e.data;
        oTest.scrollTop = oTest.scrollHeight;
    };
    window.setInterval(a, 1000); // 心跳
    function a() {
        r = document.getElementById("v");
        ws.send(v.value);
    }
</script>


